package com.xzh.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@TableName("courses")
@JsonIgnoreProperties({"handler", "hibernateLazyInitializer"})
public class Courses {
    @TableId(type = IdType.AUTO)
    private Integer courseId;
    @NotBlank(message = "会员姓名不可为空")
    @TableField(condition = SqlCondition.LIKE, whereStrategy = FieldStrategy.NOT_EMPTY)
    private String courseName;
    @TableField(condition = SqlCondition.LIKE, whereStrategy = FieldStrategy.NOT_EMPTY)
    private String teacherName;

    private Integer teacherId;
    private Integer credit;
    @NotBlank(message = "课程类别不可为空")
    @Pattern(regexp = "^(必修|选修|通识)$", message = "课程类别只能为必修,选修,通识其中之一")
    private String courseType;

    private String description;

    private Integer maxStudents;
    @NotBlank(message = "课程状态不可为空")
    @Pattern(regexp = "^(开放|关闭)$", message = "课程状态只能为开放和关闭其中之一")
    private String status;
    private String createTime;
    private String updateTime;

    private Teachers teacher;
}
